<template>
  <div>
    <!-- <div class="toptitle">组织编码</div> -->
    <el-form :inline="true" :model="formInline" class="demo-form-inline" @keyup.enter.native="search()">
      <el-form-item label="分类名称">
        <br />
        <br />
        <el-input v-model="formInline.user" placeholder style="margin-left: -60px; width: 200px"></el-input>
      </el-form-item>
      <el-form-item label="是否关联活动">
        <br />
        <br />
        <el-select v-model="formInline.isRelatedActivity" placeholder="全部" clearable
          style="margin-left: -80px; width: 200px">
          <el-option label="是" value="1"></el-option>
          <el-option label="否" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="展示">
        <br />
        <br />
        <el-select v-model="formInline.isDisplay" placeholder="全部" clearable style="margin-left: -40px; width: 200px">
          <el-option label="展示" value="1"></el-option>
          <el-option label="不展示" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="状态">
        <br />
        <br />
        <el-select v-model="formInline.status" placeholder="全部" clearable style="margin-left: -40px; width: 200px">
          <el-option label="启用" value="1"></el-option>
          <el-option label="停用" value="0"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item style="margin-left: 950px; text-align: right">
        <el-button type="primary" @click="search()" size="mini" icon="el-icon-search">查询</el-button>
        <!-- </el-form-item>
            <el-form-item> -->
        <el-button type="primary" @click="kong()" size="mini" icon="el-icon-delete">清空</el-button>
        <!-- </el-form-item>
            <el-form-item> -->
        <el-button type="primary" @click="creatoneOrg()" size="mini" icon="el-icon-edit">新增</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
      style="width: 100%; margin-bottom: 20px" row-key="goodsTypeId" border v-loading="loading" default-expand-all>
      <el-table-column type="index" label="序号" align="center" width="60"></el-table-column>
      <el-table-column prop="goodsTypeName" label="分类名称" width="180"></el-table-column>
      <el-table-column prop="isDisplay" label="是否关联活动">
        <template slot-scope="scope">{{
                    scope.row.isRelatedActivity == "1" ? "是" : "否"
                }}</template>
      </el-table-column>
      <el-table-column prop="isDisplay" label="是否展示">
        <template slot-scope="scope">{{
                    scope.row.isDisplay === 0 ? "不展示" : "展示"
                }}</template>
      </el-table-column>
      <el-table-column prop="sortNo" label="展示序号" align="center" width="120"></el-table-column>
      <el-table-column prop="displayForm" label="展示形式">
        <template slot-scope="scope">{{
                    scope.row.displayForm === 1 ? "单个陈列" : "两个陈列"
                }}</template>
      </el-table-column>

      <!-- <el-table-column align="center" prop="tagUrl" label="图标" width="200">
                <template slot-scope="scope">
                    <img
                        :src="scope.row.tagUrl"
                        v-if="scope.row.tagUrl !='' && scope.row.tagUrl !=null"
                        width="70"
                        height="50"
                    />
                </template>
            </el-table-column>
            <el-table-column align="center" prop="picUrl" label="图片" width="200">
                <template slot-scope="scope">
                    <img
                        :src="scope.row.picUrl"
                        v-if="scope.row.picUrl !='' && scope.row.picUrl !=null"
                        width="70"
                        height="50"
                    />
                </template>
            </el-table-column>-->
      <el-table-column prop="date" label="状态" align="center">
        <template slot-scope="scope">{{
                    scope.row.status === 0 ? "禁用" : "启用"
                }}</template>
      </el-table-column>
      <el-table-column label="操作" width="280" align="center" fixed="right">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.status == 1" @click="updateStatus(scope.row.goodsTypeId, 0)">停用
          </el-button>
          <el-button type="text" v-if="scope.row.status == 0" @click="updateStatus(scope.row.goodsTypeId, 1)">启用
          </el-button>
          <el-button type="text" size="mini" @click="changeorg(scope.row)">修改</el-button>
          <el-button type="text" size="mini" @click="handledelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-form :inline="true" :model="formInline">
      <el-form-item style="margin-top: 6px"></el-form-item>
    </el-form>
    <div class="block" style="margin-top: -49px">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :page-sizes="[10, 20, 30, 50, 100, 150, 200]" :current-page="listQuery.current" :page-size="listQuery.size"
        layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
    </div>
    <!--添加-->
    <el-dialog title="信息" :visible.sync="dialogVisibleorg" width="50%">
      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px">
        <el-form-item label="分类名称" prop="goodsTypeName">
          <el-input v-model="ruleForm.goodsTypeName" maxlength="20"></el-input>
        </el-form-item>
        <el-form-item label="是否关联活动" prop="isRelatedActivity">
          <el-radio-group v-model="ruleForm.isRelatedActivity" size="mini">
            <el-radio-button label="0">否</el-radio-button>
            <el-radio-button label="1">是</el-radio-button>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="展示顺序" prop="sortNo">
          <el-input v-model="ruleForm.sortNo" type="number" :min="this.total + 1" @change="
                            (data) => {
                                ruleForm.sortNo = checkSortNo(data);
                            }
                        "></el-input>
        </el-form-item>
        <el-form-item label="是否展示(小程序)" prop="ruleForm.isDisplay">
          <el-select v-model="ruleForm.isDisplay">
            <el-option label="不展示" :value="0"></el-option>
            <el-option label="展示" :value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="展示形式(小程序)" prop="displayForm">
          <el-select v-model="ruleForm.displayForm">
            <el-option label="单个陈列" :value="1"></el-option>
            <el-option label="两个陈列" :value="2"></el-option>
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="分类图标:" prop="tagUrl">
                    <el-row>
                        <el-col style="margin: 10px; 0px; 10px; 0">
                            <el-upload
                                style="margin: 10px;"
                                :action="action"
                                list-type="picture-card"
                                :limit="1"
                                :on-preview="handlePictureCardPreview"
                                :on-success="upLoadPicone"
                                :on-change="handleImgChangeone"
                                :file-list="imgListone"
                                :headers="headers"
                            >
                                <i class="el-icon-plus"></i>
                            </el-upload>
                        </el-col>
                    </el-row>
                </el-form-item>
                <el-form-item label="分类照片:" prop="picUrl">
                    <el-row>
                        <el-col style="margin: 10px; 0px; 10px; 0">
                            <el-upload
                                style="margin: 10px;"
                                :action="action"
                                list-type="picture-card"
                                :limit="1"
                                :on-preview="handlePictureCardPreview"
                                :on-success="upLoadPictwo"
                                :on-change="handleImgChangetwo"
                                :file-list="imgListtwo"
                                :headers="headers"
                            >
                                <i class="el-icon-plus"></i>
                            </el-upload>
                        </el-col>
                    </el-row>
                </el-form-item>-->
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleorg = false" size="mini">取 消</el-button>
        <el-button type="primary" @click="confirmEditone()" size="mini">确 定</el-button>
      </span>
    </el-dialog>

    <!--修改-->
    <el-dialog title="信息" :visible.sync="dialogVisibleorgone" width="50%">
      <el-form :model="ruleFormorg" :rules="rules" ref="ruleFormorg" label-width="120px">
        <el-form :model="ruleFormorg" :rules="rules" ref="ruleFormorg" label-width="120px">
          <el-form-item label="分类名称" prop="goodsTypeName">
            <el-input v-model="ruleFormorg.goodsTypeName" maxlength="20"></el-input>
          </el-form-item>
          <el-form-item label="是否关联活动" prop="isRelatedActivity">
            <el-radio-group v-model="ruleFormorg.isRelatedActivity" size="mini">
              <el-radio-button label="0">否</el-radio-button>
              <el-radio-button label="1">是</el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="展示顺序" prop="sortNo">
            <el-input v-model="ruleFormorg.sortNo" type="number" :min="this.total + 1" @change="
                                (data) => {
                                    ruleFormorg.sortNo = checkSortNo(data);
                                }
                            "></el-input>
          </el-form-item>
          <el-form-item label="是否展示" prop="isDisplay">
            <el-select v-model="ruleFormorg.isDisplay">
              <el-option label="不展示" :value="0"></el-option>
              <el-option label="展示" :value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="展示形式" prop="displayForm">
            <el-select v-model="ruleFormorg.displayForm">
              <el-option label="单个陈列" :value="1"></el-option>
              <el-option label="两个陈列" :value="2"></el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="分类图标:" prop="tagUrl">
                        <el-row>
                            <el-col style="margin: 10px; 0px; 10px; 0">
                                <el-upload
                                    style="margin: 10px;"
                                    :action="action"
                                    list-type="picture-card"
                                    :limit="1"
                                    :on-preview="handlePictureCardPreview"
                                    :on-success="upLoadPicone"
                                    :on-change="handleImgChangeone"
                                    :file-list="imgListone"
                                    :headers="headers"
                                    :on-exceed="handleExceed"
                                >
                                    <i class="el-icon-plus"></i>
                                </el-upload>
                            </el-col>
                        </el-row>
                    </el-form-item>
                    <el-form-item label="分类照片:" prop="picUrl">
                        <el-row>
                            <el-col style="margin: 10px; 0px; 10px; 0">
                                <el-upload
                                    style="margin: 10px;"
                                    :action="action"
                                    list-type="picture-card"
                                    :limit="1"
                                    :on-preview="handlePictureCardPreview"
                                    :on-success="upLoadPictwo"
                                    :on-change="handleImgChangetwo"
                                    :file-list="imgListtwo"
                                    :headers="headers"
                                    :on-exceed="handleExceed"
                                >
                                    <i class="el-icon-plus"></i>
                                </el-upload>
                            </el-col>
                        </el-row>
                    </el-form-item>-->
        </el-form>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleorgone = false" size="mini">取 消</el-button>
        <el-button type="primary" @click="confirmEdittwo()" size="mini">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="dialogVisibleImg">
      <img width="100%" :src="dialogImageUrl" alt />
    </el-dialog>
  </div>
</template>

<script>
  import {
    queryGoodsTypeList,
    addGoodsType,
    addLowerGoodsType,
    deleteGoodsType,
    updaterole,
    getUserOrgType
  } from "@/api/headProductclass";
  import qs from "qs";
  export default {
    data() {
      return {
        // action: `${process.env.VUE_APP_BASE_API}/api/file-service/v1/file/uploadFile`,
        headers: {
          token: localStorage.getItem("token"), //从cookie里获取token，并赋值  Authorization ，而不是token
        },
        tableData: [],
        txtVal: "",
        picUrl: "",
        loading: true,
        dialogVisibleorg: false,
        dialogVisibleorgone: false,
        imgListone: [],
        imgListtwo: [],
        ruleForm: {
          goodsTypeId: "",
          goodsTypeName: "",
          isRelatedActivity: 0,
          sortNo: 0,
          tagUrl: "",
          picUrl: "",
          isDisplay: 1,
          displayForm: 1,
          goodsTypeId: "",
          upGoodsType: ""
        },
        orgSeqxia: "",
        ruleFormorg: {
          goodsTypeId: "",
          goodsTypeName: "",
          isRelatedActivity: 0,
          sortNo: 0,
          tagUrl: "",
          picUrl: "",
          isDisplay: 1,
          displayForm: 1,
          goodsTypeId: "",
          upGoodsType: ""
        },
        total: 0,
        options: [],
        optionsone: [],
        listQuery: {
          current: 1,
          size: 100
        },
        flagorg: false,
        dialogVisible: false,
        dialogVisibleImg: false,
        dialogImageUrl: "",
        formInline: {
          user: "",
          isRelatedActivity: "",
          region: "",
          status: "1",
          isDisplay: "",
        },
        rules: {
          goodsTypeName: [{
            required: true,
            message: "请输入商品名称",
            trigger: "blur"
          }],
          // tagUrl: [
          //     { required: true, message: "请上传图标", trigger: "blur" }
          // ],
          // picUrl: [
          //     { required: true, message: "请上传图片", trigger: "blur" }
          // ]
        }
      };
    },
    mounted() {
      this.rolemanageone();
    },
    methods: {
      //初始化加载
      rolemanageone() {
        let data = {
          size: this.listQuery.size,
          current: this.listQuery.current,
          condition: {
            goodsTypeName: this.formInline.user,
            isRelatedActivity: this.formInline.rolemanageone,
            status: this.formInline.status,
            isDisplay: this.formInline.isDisplay,
          }
        };
        queryGoodsTypeList(data).then(res => {
          res.records.forEach((item, i) => {
            this.options.push({
              value: item.goodsTypeId,
              label: item.orgName
            });
          });

          this.loading = false;
          this.total = res.total;
          this.tableData = res.records;
          console.log(this.tableData, "ppe");
        });

        //   let dataone = {
        //     orgType: "",
        //     orgTypeName: ""
        //   };

        //   getUserOrgType(dataone).then(res => {
        //     res.records.forEach((item, i) => {
        //       this.optionsone.push({
        //         value: item.orgType,
        //         label: item.orgTypeName
        //       });
        //     });
        //   });
      },
      //清空
      kong() {
        this.formInline.user = "";
        this.formInline.isRelatedActivity = "";
        this.formInline.status = "1";
        this.formInline.isDisplay = "";
      },
      //查询
      search() {
        this.listQuery.current = 1;
        let data = {
          size: this.listQuery.size,
          current: this.listQuery.current,
          condition: {
            goodsTypeName: this.formInline.user,
            isRelatedActivity: this.formInline.isRelatedActivity,
            status: this.formInline.status,
            isDisplay: this.formInline.isDisplay,
          }
        };
        queryGoodsTypeList(data).then(res => {
          this.total = res.total;
          this.tableData = res.records;
        });
      },
      //新增分类
      creatoneOrg() {
        this.dialogVisibleorg = !this.dialogVisibleorg;
        this.ruleForm.goodsTypeName = "";
        this.ruleForm.sortNo = this.total + 1;
        (this.ruleForm.picUrl = ""), (this.ruleForm.isDisplay = 1);
        this.ruleForm.displayForm = 1;
        this.imgListtwo = [];
        this.imgListone = [];
      },
      creatoneOrgone(v) {
        console.log(v, "ll");
        this.flagorg = true;
        this.orgSeqxia = v.goodsTypeId;
        this.dialogVisibleorgone = !this.dialogVisibleorgone;
      },
      //修改分类
      changeorg(v) {
        this.dialogVisibleorgone = !this.dialogVisibleorgone;
        var userId = localStorage.getItem("userId");
        var picture = v.picUrl;
        this.imgListtwo = [];
        this.imgListone = [];
        if (v.tagUrl != "" && v.tagUrl != null) {
          let data = {
            name: "",
            url: v.tagUrl
          };
          this.imgListone.push(data);
        }
        if (picture != "" && picture != null) {
          let data = {
            name: "",
            url: picture
          };
          this.imgListtwo.push(data);
        }
        this.ruleFormorg.goodsTypeName = v.goodsTypeName;
        this.ruleFormorg.goodsTypeId = v.goodsTypeId;
        this.ruleFormorg.isRelatedActivity = v.isRelatedActivity;
        (this.ruleFormorg.sortNo = v.sortNo),
        (this.ruleFormorg.tagUrl = v.tagUrl),
        (this.ruleFormorg.picUrl = v.picUrl),
        (this.ruleFormorg.isDisplay = v.isDisplay),
        (this.ruleFormorg.displayForm = v.displayForm),
        (this.ruleFormorg.upGoodsType = v.upGoodsType),
        (this.flagorg = false);
      },
      //确认添加
      confirmEditone() {
        //   if (
        //         this.ruleForm.tagUrl == "" ||
        //         this.ruleForm.tagUrl == null
        //     ) {
        //         this.$message.error("请上传图标");
        //         return;
        //     }
        //     if (this.ruleForm.picUrl == "" || this.ruleForm.picUrl == null) {
        //         this.$message.error("请上传图片");
        //         return;
        //     }
        let data = {
          goodsTypeName: this.ruleForm.goodsTypeName,
          isRelatedActivity: this.ruleForm.isRelatedActivity,
          sortNo: this.ruleForm.sortNo,
          tagUrl: this.ruleForm.tagUrl,
          picUrl: this.ruleForm.picUrl,
          isDisplay: this.ruleForm.isDisplay,
          displayForm: this.ruleForm.displayForm,
          goodsTypeId: this.ruleForm.goodsTypeId,
          upGoodsType: this.ruleForm.upGoodsType
        };
        addGoodsType(data).then(res => {
          this.$message({
            showClose: true,
            message: "添加成功",
            type: "success"
          });
          this.dialogVisibleorg = !this.dialogVisibleorg;
          this.rolemanageone();
        });
      },
      //确定修改
      confirmEdittwo() {
        // if (
        //     this.ruleFormorg.tagUrl == "" ||
        //     this.ruleFormorg.tagUrl == null
        // ) {
        //     this.$message.error("请上传图标");
        //     return;
        // }
        // if (
        //     this.ruleFormorg.picUrl == "" ||
        //     this.ruleFormorg.picUrl == null
        // ) {
        //     this.$message.error("请上传图片");
        //     return;
        // }
        if (this.flagorg == false) {
          let dataone = {
            goodsTypeName: this.ruleFormorg.goodsTypeName,
            isRelatedActivity: this.ruleFormorg.isRelatedActivity,
            sortNo: this.ruleFormorg.sortNo,
            picUrl: this.ruleFormorg.picUrl,
            tagUrl: this.ruleFormorg.tagUrl,
            isDisplay: this.ruleFormorg.isDisplay,
            displayForm: this.ruleFormorg.displayForm,
            goodsTypeId: this.ruleFormorg.goodsTypeId
          };
          addGoodsType(dataone).then(res => {
            this.dialogVisibleorgone = !this.dialogVisibleorgone;
            this.$message({
              showClose: true,
              message: "修改成功",
              type: "success"
            });
            this.rolemanageone();
          });
        } else if (this.flagorg == true) {
          let data = {
            goodsTypeName: this.ruleFormorg.goodsTypeName,
            isRelatedActivity: this.ruleFormorg.isRelatedActivity,
            sortNo: this.ruleFormorg.sortNo,
            tagUrl: this.ruleFormorg.tagUrl,
            picUrl: this.ruleFormorg.picUrl,
            isDisplay: this.ruleFormorg.isDisplay,
            displayForm: this.ruleFormorg.displayForm,
            goodsTypeId: this.ruleFormorg.goodsTypeId,
            upGoodsType: this.orgSeqxia
          };
          addGoodsType(data).then(res => {
            this.$message({
              showClose: true,
              message: "添加成功",
              type: "success"
            });
            this.dialogVisibleorgone = !this.dialogVisibleorgone;
            this.rolemanageone();
          });
        }
      },
      //停用启用
      updateStatus(goodsTypeId, status) {
        let data = {
          goodsTypeId: goodsTypeId,
          status: status
        };
        addGoodsType(data).then(res => {
          var msg = "";
          if (status == "1") {
            msg = "启用";
          } else if (status == "0") {
            msg = "停用";
          } else if (status == "2") {
            msg = "删除";
          }
          if (res.code == "1") {
            this.$message({
              showClose: true,
              message: msg + "成功",
              type: "success"
            });
            this.rolemanageone();
          } else {
            this.$message.error(msg + "失败");
          }
        });
      },
      indexMethod(index) {
        let curpage = this.listQuery.current; //单前页码，具体看组件取值
        let limitpage = this.listQuery.size; //每页条数，具体是组件取值
        return index + 1 + (curpage - 1) * limitpage;
      },
      handledelete(v) {
        let data = {
          goodsTypeId: v.goodsTypeId
        };
        this.$confirm("确认删除吗？").then(_ => {
          deleteGoodsType(qs.stringify(data)).then(res => {
            this.$message({
              showClose: true,
              message: res.message,
              type: res.code == 1 ? "success" : "error"
            });
            this.rolemanageone();
          });
        });
      },
      add() {
        // this.dialogVisible = !this.dialogVisible;
        this.editflag = true;
      },
      edit(v) {
        console.log(v, "kkdd");
        this.ruleForm.orgName = v.orgName;
        this.ruleForm.goodsTypeId = v.goodsTypeId;
        this.ruleForm.upOrgSeq = v.upOrgSeq;
        this.ruleForm.upOrgSeqName = v.upOrgSeqName;
        this.ruleForm.orgType = v.orgType;
        this.ruleForm.updateUser = v.updateUser;
        this.ruleForm.sortNo = v.sortNo;
        this.ruleForm.tagUrl = v.tagUrl;
        this.ruleForm.picUrl = v.picUrl;
        console.log(v, "pp");
        // this.dialogVisible = !this.dialogVisible;
        this.editflag = false;
      },
      confirmEdit(v) {
        if (this.ruleForm.orgName == "" || this.ruleForm.orgName == null) {
          this.$message.error("请输入本级组织名称");
          return;
        }
        if (
          this.ruleForm.goodsTypeId == "" ||
          this.ruleForm.goodsTypeId == null
        ) {
          this.$message.error("请输入本级组织编码");
          return;
        }
        if (
          this.ruleForm.upOrgSeq == "" ||
          this.ruleForm.upOrgSeq == null
        ) {
          this.$message.error("请选择上级组织名称");
          return;
        }
        if (this.ruleForm.orgType == "" || this.ruleForm.orgType == null) {
          this.$message.error("请选择组织类型");
          return;
        }
        if (this.editflag) {
          //   var u1 = "u1";
          var userId = localStorage.getItem("userId");
          let data = {
            orgName: this.ruleForm.orgName,
            goodsTypeId: this.ruleForm.goodsTypeId,
            upOrgSeq: this.ruleForm.upOrgSeq,
            upOrgSeqName: this.ruleForm.upOrgSeqName,
            sortNo: this.ruleForm.sortNo,
            picUrl: this.ruleForm.picUrl,
            tagUrl: this.ruleForm.tagUrl,
            updateUser: this.ruleForm.updateUser
          };
          addGoodsType(data).then(res => {
            this.dialogVisible = !this.dialogVisible;
            this.$message({
              showClose: true,
              message: "添加成功",
              type: "success"
            });
            this.rolemanageone();
          });
        } else {
          //var u1 = "u1";
          var userId = localStorage.getItem("userId");
          let data = {
            orgName: this.ruleForm.orgName,
            goodsTypeId: this.ruleForm.goodsTypeId,
            picUrl: this.ruleForm.picUrl,
            tagUrl: this.ruleForm.tagUrl,
            updateUser: this.ruleForm.updateUser
          };
          updaterole(data).then(res => {
            this.dialogVisible = !this.dialogVisible;
            this.$message({
              showClose: true,
              message: res.message,
              type: "success"
            });
            this.rolemanageone();
          });
        }
      },
      handleSizeChange(val) {
        this.listQuery.size = val;
        this.rolemanageone();
      },
      handleCurrentChange(val) {
        this.listQuery.current = val;
        this.rolemanageone();
      },


      descInput() {
        this.txtVal = this.updateDiseaseForm.memo.length;
      },
      handlePictureCardPreview(file) {
        this.dialogImageUrl = file.url;
        this.dialogVisibleImg = true;
      },
      upLoadPicone(file, fileList) {
        this.imgListone = [];
        this.ruleForm.tagUrl = file.result;
        this.ruleFormorg.tagUrl = file.result;
      },
      handleImgChangeone(file, fileList) {
        if (file.response) {
          this.imgListone.push({
            url: file.response.result,
            status: "finished"
          });
        }
      },
      upLoadPictwo(file, fileList) {
        this.imgListtwo = [];
        this.ruleForm.picUrl = file.result;
        this.ruleFormorg.picUrl = file.result;
      },
      handleImgChangetwo(file, fileList) {
        if (file.response) {
          this.imgListtwo.push({
            url: file.response.result,
            status: "finished"
          });
        }
      },
      checkSortNo(val, type) {
        // 值，符号
        if (val === null || val === undefined || val === "") {
          return this.total + 1;
        } else {
          var aaa = Number(this.total + 1);
          if (Number(val) < aaa) {
            this.$confirm(
                "此操作将排序小于推荐值" + aaa + ", 是否继续?",
                "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  type: "warning"
                }
              )
              .then(() => {
                return (
                  (this.ruleForm.sortNo = val),
                  (this.ruleFormorg.sortNo = val)
                );
              })
              .catch(() => {
                return (
                  (this.ruleForm.sortNo = aaa),
                  (this.ruleFormorg.sortNo = aaa)
                );
              });
          } else {
            return val;
          }
        }
      },
      handleExceed(file, fileList6) {
        this.$message.error(`图片最多上传1张`)
      }
    }
  };
</script>
<style lang="less" scoped>
  .toptitle {
    border: 1px solid #e0e0e0;
    border-bottom: 2px solid #188097;
    background: #f5f5f5;
    line-height: 35px;
    margin-bottom: 10px;
    padding: 0 10px;
    font-size: 14px;
    font-weight: bold;
  }

  .el-form-item .el-select {
    width: 100%;
  }
</style>
